
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _Suppliers : SqlClientEntity
	{
		public _Suppliers()
		{
			this.QuerySource = "Suppliers";
			this.MappingName = "Suppliers";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_SuppliersLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_SuppliersLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter SupplierName
			{
				get
				{
					return new SqlParameter("@SupplierName", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter ABN
			{
				get
				{
					return new SqlParameter("@ABN", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter Address
			{
				get
				{
					return new SqlParameter("@Address", SqlDbType.NVarChar, 100);
				}
			}
			
			public static SqlParameter Phone
			{
				get
				{
					return new SqlParameter("@Phone", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter Fax
			{
				get
				{
					return new SqlParameter("@Fax", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter Email
			{
				get
				{
					return new SqlParameter("@Email", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter AccountNo
			{
				get
				{
					return new SqlParameter("@AccountNo", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter Deleted
			{
				get
				{
					return new SqlParameter("@Deleted", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter LastModifiedDate
			{
				get
				{
					return new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter LastModifiedByUser
			{
				get
				{
					return new SqlParameter("@LastModifiedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter TotalAmount
			{
				get
				{
					return new SqlParameter("@TotalAmount", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter PaidAmount
			{
				get
				{
					return new SqlParameter("@PaidAmount", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter BranchID
			{
				get
				{
					return new SqlParameter("@BranchID", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string SupplierName = "SupplierName";
            public const string ABN = "ABN";
            public const string Address = "Address";
            public const string Phone = "Phone";
            public const string Fax = "Fax";
            public const string Email = "Email";
            public const string AccountNo = "AccountNo";
            public const string Deleted = "Deleted";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string TotalAmount = "TotalAmount";
            public const string PaidAmount = "PaidAmount";
            public const string BranchID = "BranchID";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Suppliers.PropertyNames.ID;
					ht[SupplierName] = _Suppliers.PropertyNames.SupplierName;
					ht[ABN] = _Suppliers.PropertyNames.ABN;
					ht[Address] = _Suppliers.PropertyNames.Address;
					ht[Phone] = _Suppliers.PropertyNames.Phone;
					ht[Fax] = _Suppliers.PropertyNames.Fax;
					ht[Email] = _Suppliers.PropertyNames.Email;
					ht[AccountNo] = _Suppliers.PropertyNames.AccountNo;
					ht[Deleted] = _Suppliers.PropertyNames.Deleted;
					ht[LastModifiedDate] = _Suppliers.PropertyNames.LastModifiedDate;
					ht[LastModifiedByUser] = _Suppliers.PropertyNames.LastModifiedByUser;
					ht[TotalAmount] = _Suppliers.PropertyNames.TotalAmount;
					ht[PaidAmount] = _Suppliers.PropertyNames.PaidAmount;
					ht[BranchID] = _Suppliers.PropertyNames.BranchID;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string SupplierName = "SupplierName";
            public const string ABN = "ABN";
            public const string Address = "Address";
            public const string Phone = "Phone";
            public const string Fax = "Fax";
            public const string Email = "Email";
            public const string AccountNo = "AccountNo";
            public const string Deleted = "Deleted";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string TotalAmount = "TotalAmount";
            public const string PaidAmount = "PaidAmount";
            public const string BranchID = "BranchID";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Suppliers.ColumnNames.ID;
					ht[SupplierName] = _Suppliers.ColumnNames.SupplierName;
					ht[ABN] = _Suppliers.ColumnNames.ABN;
					ht[Address] = _Suppliers.ColumnNames.Address;
					ht[Phone] = _Suppliers.ColumnNames.Phone;
					ht[Fax] = _Suppliers.ColumnNames.Fax;
					ht[Email] = _Suppliers.ColumnNames.Email;
					ht[AccountNo] = _Suppliers.ColumnNames.AccountNo;
					ht[Deleted] = _Suppliers.ColumnNames.Deleted;
					ht[LastModifiedDate] = _Suppliers.ColumnNames.LastModifiedDate;
					ht[LastModifiedByUser] = _Suppliers.ColumnNames.LastModifiedByUser;
					ht[TotalAmount] = _Suppliers.ColumnNames.TotalAmount;
					ht[PaidAmount] = _Suppliers.ColumnNames.PaidAmount;
					ht[BranchID] = _Suppliers.ColumnNames.BranchID;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string SupplierName = "s_SupplierName";
            public const string ABN = "s_ABN";
            public const string Address = "s_Address";
            public const string Phone = "s_Phone";
            public const string Fax = "s_Fax";
            public const string Email = "s_Email";
            public const string AccountNo = "s_AccountNo";
            public const string Deleted = "s_Deleted";
            public const string LastModifiedDate = "s_LastModifiedDate";
            public const string LastModifiedByUser = "s_LastModifiedByUser";
            public const string TotalAmount = "s_TotalAmount";
            public const string PaidAmount = "s_PaidAmount";
            public const string BranchID = "s_BranchID";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual string SupplierName
	    {
			get
	        {
				return base.Getstring(ColumnNames.SupplierName);
			}
			set
	        {
				base.Setstring(ColumnNames.SupplierName, value);
			}
		}

		public virtual string ABN
	    {
			get
	        {
				return base.Getstring(ColumnNames.ABN);
			}
			set
	        {
				base.Setstring(ColumnNames.ABN, value);
			}
		}

		public virtual string Address
	    {
			get
	        {
				return base.Getstring(ColumnNames.Address);
			}
			set
	        {
				base.Setstring(ColumnNames.Address, value);
			}
		}

		public virtual string Phone
	    {
			get
	        {
				return base.Getstring(ColumnNames.Phone);
			}
			set
	        {
				base.Setstring(ColumnNames.Phone, value);
			}
		}

		public virtual string Fax
	    {
			get
	        {
				return base.Getstring(ColumnNames.Fax);
			}
			set
	        {
				base.Setstring(ColumnNames.Fax, value);
			}
		}

		public virtual string Email
	    {
			get
	        {
				return base.Getstring(ColumnNames.Email);
			}
			set
	        {
				base.Setstring(ColumnNames.Email, value);
			}
		}

		public virtual string AccountNo
	    {
			get
	        {
				return base.Getstring(ColumnNames.AccountNo);
			}
			set
	        {
				base.Setstring(ColumnNames.AccountNo, value);
			}
		}

		public virtual bool Deleted
	    {
			get
	        {
				return base.Getbool(ColumnNames.Deleted);
			}
			set
	        {
				base.Setbool(ColumnNames.Deleted, value);
			}
		}

		public virtual DateTime LastModifiedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.LastModifiedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual int LastModifiedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual decimal TotalAmount
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.TotalAmount);
			}
			set
	        {
				base.Setdecimal(ColumnNames.TotalAmount, value);
			}
		}

		public virtual decimal PaidAmount
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.PaidAmount);
			}
			set
	        {
				base.Setdecimal(ColumnNames.PaidAmount, value);
			}
		}

		public virtual int BranchID
	    {
			get
	        {
				return base.Getint(ColumnNames.BranchID);
			}
			set
	        {
				base.Setint(ColumnNames.BranchID, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_SupplierName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SupplierName) ? string.Empty : base.GetstringAsString(ColumnNames.SupplierName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SupplierName);
				else
					this.SupplierName = base.SetstringAsString(ColumnNames.SupplierName, value);
			}
		}

		public virtual string s_ABN
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ABN) ? string.Empty : base.GetstringAsString(ColumnNames.ABN);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ABN);
				else
					this.ABN = base.SetstringAsString(ColumnNames.ABN, value);
			}
		}

		public virtual string s_Address
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Address) ? string.Empty : base.GetstringAsString(ColumnNames.Address);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Address);
				else
					this.Address = base.SetstringAsString(ColumnNames.Address, value);
			}
		}

		public virtual string s_Phone
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Phone) ? string.Empty : base.GetstringAsString(ColumnNames.Phone);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Phone);
				else
					this.Phone = base.SetstringAsString(ColumnNames.Phone, value);
			}
		}

		public virtual string s_Fax
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Fax) ? string.Empty : base.GetstringAsString(ColumnNames.Fax);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Fax);
				else
					this.Fax = base.SetstringAsString(ColumnNames.Fax, value);
			}
		}

		public virtual string s_Email
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Email) ? string.Empty : base.GetstringAsString(ColumnNames.Email);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Email);
				else
					this.Email = base.SetstringAsString(ColumnNames.Email, value);
			}
		}

		public virtual string s_AccountNo
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.AccountNo) ? string.Empty : base.GetstringAsString(ColumnNames.AccountNo);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.AccountNo);
				else
					this.AccountNo = base.SetstringAsString(ColumnNames.AccountNo, value);
			}
		}

		public virtual string s_Deleted
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Deleted) ? string.Empty : base.GetboolAsString(ColumnNames.Deleted);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Deleted);
				else
					this.Deleted = base.SetboolAsString(ColumnNames.Deleted, value);
			}
		}

		public virtual string s_LastModifiedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.LastModifiedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedDate);
				else
					this.LastModifiedDate = base.SetDateTimeAsString(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual string s_LastModifiedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedByUser) ? string.Empty : base.GetintAsString(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedByUser);
				else
					this.LastModifiedByUser = base.SetintAsString(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual string s_TotalAmount
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.TotalAmount) ? string.Empty : base.GetdecimalAsString(ColumnNames.TotalAmount);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.TotalAmount);
				else
					this.TotalAmount = base.SetdecimalAsString(ColumnNames.TotalAmount, value);
			}
		}

		public virtual string s_PaidAmount
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PaidAmount) ? string.Empty : base.GetdecimalAsString(ColumnNames.PaidAmount);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PaidAmount);
				else
					this.PaidAmount = base.SetdecimalAsString(ColumnNames.PaidAmount, value);
			}
		}

		public virtual string s_BranchID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BranchID) ? string.Empty : base.GetintAsString(ColumnNames.BranchID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BranchID);
				else
					this.BranchID = base.SetintAsString(ColumnNames.BranchID, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SupplierName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SupplierName, Parameters.SupplierName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ABN
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ABN, Parameters.ABN);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Address
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Address, Parameters.Address);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Phone
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Phone, Parameters.Phone);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Fax
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Fax, Parameters.Fax);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Email
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Email, Parameters.Email);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter AccountNo
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.AccountNo, Parameters.AccountNo);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Deleted
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter TotalAmount
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.TotalAmount, Parameters.TotalAmount);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PaidAmount
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PaidAmount, Parameters.PaidAmount);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BranchID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter SupplierName
		    {
				get
		        {
					if(_SupplierName_W == null)
	        	    {
						_SupplierName_W = TearOff.SupplierName;
					}
					return _SupplierName_W;
				}
			}

			public WhereParameter ABN
		    {
				get
		        {
					if(_ABN_W == null)
	        	    {
						_ABN_W = TearOff.ABN;
					}
					return _ABN_W;
				}
			}

			public WhereParameter Address
		    {
				get
		        {
					if(_Address_W == null)
	        	    {
						_Address_W = TearOff.Address;
					}
					return _Address_W;
				}
			}

			public WhereParameter Phone
		    {
				get
		        {
					if(_Phone_W == null)
	        	    {
						_Phone_W = TearOff.Phone;
					}
					return _Phone_W;
				}
			}

			public WhereParameter Fax
		    {
				get
		        {
					if(_Fax_W == null)
	        	    {
						_Fax_W = TearOff.Fax;
					}
					return _Fax_W;
				}
			}

			public WhereParameter Email
		    {
				get
		        {
					if(_Email_W == null)
	        	    {
						_Email_W = TearOff.Email;
					}
					return _Email_W;
				}
			}

			public WhereParameter AccountNo
		    {
				get
		        {
					if(_AccountNo_W == null)
	        	    {
						_AccountNo_W = TearOff.AccountNo;
					}
					return _AccountNo_W;
				}
			}

			public WhereParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public WhereParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public WhereParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public WhereParameter TotalAmount
		    {
				get
		        {
					if(_TotalAmount_W == null)
	        	    {
						_TotalAmount_W = TearOff.TotalAmount;
					}
					return _TotalAmount_W;
				}
			}

			public WhereParameter PaidAmount
		    {
				get
		        {
					if(_PaidAmount_W == null)
	        	    {
						_PaidAmount_W = TearOff.PaidAmount;
					}
					return _PaidAmount_W;
				}
			}

			public WhereParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _SupplierName_W = null;
			private WhereParameter _ABN_W = null;
			private WhereParameter _Address_W = null;
			private WhereParameter _Phone_W = null;
			private WhereParameter _Fax_W = null;
			private WhereParameter _Email_W = null;
			private WhereParameter _AccountNo_W = null;
			private WhereParameter _Deleted_W = null;
			private WhereParameter _LastModifiedDate_W = null;
			private WhereParameter _LastModifiedByUser_W = null;
			private WhereParameter _TotalAmount_W = null;
			private WhereParameter _PaidAmount_W = null;
			private WhereParameter _BranchID_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_SupplierName_W = null;
				_ABN_W = null;
				_Address_W = null;
				_Phone_W = null;
				_Fax_W = null;
				_Email_W = null;
				_AccountNo_W = null;
				_Deleted_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_TotalAmount_W = null;
				_PaidAmount_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SupplierName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SupplierName, Parameters.SupplierName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ABN
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ABN, Parameters.ABN);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Address
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Address, Parameters.Address);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Phone
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Phone, Parameters.Phone);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Fax
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Fax, Parameters.Fax);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Email
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Email, Parameters.Email);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter AccountNo
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.AccountNo, Parameters.AccountNo);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Deleted
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter TotalAmount
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.TotalAmount, Parameters.TotalAmount);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PaidAmount
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PaidAmount, Parameters.PaidAmount);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BranchID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter SupplierName
		    {
				get
		        {
					if(_SupplierName_W == null)
	        	    {
						_SupplierName_W = TearOff.SupplierName;
					}
					return _SupplierName_W;
				}
			}

			public AggregateParameter ABN
		    {
				get
		        {
					if(_ABN_W == null)
	        	    {
						_ABN_W = TearOff.ABN;
					}
					return _ABN_W;
				}
			}

			public AggregateParameter Address
		    {
				get
		        {
					if(_Address_W == null)
	        	    {
						_Address_W = TearOff.Address;
					}
					return _Address_W;
				}
			}

			public AggregateParameter Phone
		    {
				get
		        {
					if(_Phone_W == null)
	        	    {
						_Phone_W = TearOff.Phone;
					}
					return _Phone_W;
				}
			}

			public AggregateParameter Fax
		    {
				get
		        {
					if(_Fax_W == null)
	        	    {
						_Fax_W = TearOff.Fax;
					}
					return _Fax_W;
				}
			}

			public AggregateParameter Email
		    {
				get
		        {
					if(_Email_W == null)
	        	    {
						_Email_W = TearOff.Email;
					}
					return _Email_W;
				}
			}

			public AggregateParameter AccountNo
		    {
				get
		        {
					if(_AccountNo_W == null)
	        	    {
						_AccountNo_W = TearOff.AccountNo;
					}
					return _AccountNo_W;
				}
			}

			public AggregateParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public AggregateParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public AggregateParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public AggregateParameter TotalAmount
		    {
				get
		        {
					if(_TotalAmount_W == null)
	        	    {
						_TotalAmount_W = TearOff.TotalAmount;
					}
					return _TotalAmount_W;
				}
			}

			public AggregateParameter PaidAmount
		    {
				get
		        {
					if(_PaidAmount_W == null)
	        	    {
						_PaidAmount_W = TearOff.PaidAmount;
					}
					return _PaidAmount_W;
				}
			}

			public AggregateParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _SupplierName_W = null;
			private AggregateParameter _ABN_W = null;
			private AggregateParameter _Address_W = null;
			private AggregateParameter _Phone_W = null;
			private AggregateParameter _Fax_W = null;
			private AggregateParameter _Email_W = null;
			private AggregateParameter _AccountNo_W = null;
			private AggregateParameter _Deleted_W = null;
			private AggregateParameter _LastModifiedDate_W = null;
			private AggregateParameter _LastModifiedByUser_W = null;
			private AggregateParameter _TotalAmount_W = null;
			private AggregateParameter _PaidAmount_W = null;
			private AggregateParameter _BranchID_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_SupplierName_W = null;
				_ABN_W = null;
				_Address_W = null;
				_Phone_W = null;
				_Fax_W = null;
				_Email_W = null;
				_AccountNo_W = null;
				_Deleted_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_TotalAmount_W = null;
				_PaidAmount_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SuppliersInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SuppliersUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_SuppliersDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SupplierName);
			p.SourceColumn = ColumnNames.SupplierName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ABN);
			p.SourceColumn = ColumnNames.ABN;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Address);
			p.SourceColumn = ColumnNames.Address;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Phone);
			p.SourceColumn = ColumnNames.Phone;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Fax);
			p.SourceColumn = ColumnNames.Fax;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Email);
			p.SourceColumn = ColumnNames.Email;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.AccountNo);
			p.SourceColumn = ColumnNames.AccountNo;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Deleted);
			p.SourceColumn = ColumnNames.Deleted;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedDate);
			p.SourceColumn = ColumnNames.LastModifiedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedByUser);
			p.SourceColumn = ColumnNames.LastModifiedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.TotalAmount);
			p.SourceColumn = ColumnNames.TotalAmount;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PaidAmount);
			p.SourceColumn = ColumnNames.PaidAmount;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
